package com.ironone.streaming.application;

import java.io.Serializable;
import java.util.Calendar;
import java.util.List;
import com.ironone.streaming.model.EventsDataModel;
import com.ironone.streaming.model.NewsDataModel;
import com.ironone.streaming.model.OurShowsDataModel;

public class FormObject extends DataObject implements Serializable {
	/**
	 * serialVersionUID came automatically with the Serializable keyword No
	 * Bitmap's are allowed here
	 */
	private static final long serialVersionUID = 1L;

	private static FormObject formObject;

	private String accessToken;
	private int dataVersion;
	private boolean[] updateArray;

	private boolean fbLoginStatus; // tempdata
	private String fbName = "";
	private String fbEmail = "";
	private String fbBirthday = "";
	private String fbLocation = "";
	private String fbGender = "";
	private String fbMusicLiked = "";
	private String fbUsername = "";
	private String fbUserId = "";
	private byte[] fbProfilePicture = null;

	private boolean isSlidingPaneLayoutSlidable; // tempdata
	private boolean isOneTimeExecuted; // tempdata
	private float textSize; // tempdata

	private String hd_stream_link;
	private String sd_stream_link;

	private String tnl_Id;
	private int screenWidth; // tempdata
	private int screenHeight; // tempdata

	private String day; // tempdata
	private int date; // tempdata
	private int month; // tempdata
	private int year; // tempdata
	private int timeDiffer; // tempdata

	// Screens Data
	List<OurShowsDataModel> showsData;
	List<EventsDataModel> eventsData;
	// List<NewsDataModel> newsData;

	// Now playing data
	byte[] albumArtImage;
	String songName = "";
	String artistName = "";

	private FormObject() {
		dataVersion = 1; // Send one initially, then send server time comes in
							// the init srv response
		updateArray = new boolean[4];
		fbLoginStatus = false;
		isSlidingPaneLayoutSlidable = false;
		isOneTimeExecuted = false;
		textSize = 10;
		tnl_Id = null;
		screenWidth = 1;
		screenHeight = 1;

		//hd_stream_link = "http://198.50.207.172:8000/live.mp3";
		//sd_stream_link = "http://198.50.207.172:8040/live.mp3";
		

		sd_stream_link= "http://192.99.99.195:8020/live.mp3";
		hd_stream_link= "http://192.99.99.195:8020/live.mp3";

	}

	public static synchronized FormObject getInstance() {
		if (formObject == null) {
			formObject = new FormObject();
		}
		return formObject;
	}

	public static FormObject getInstanceOneTime() {
		return formObject;
	}

	public static void setInstanceOneTime(FormObject fo) {
		formObject = fo;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String token) {
		this.accessToken = token;
	}

	public int getDataVersion() {
		return dataVersion;
	}

	public void setDataVersion(int dv) {
		this.dataVersion = dv;
	}

	/*  */
	public boolean[] getUpdateArray() {
		return updateArray;
	}

	public void setUpdateArray(boolean[] arr) {
		this.updateArray = arr;
	}

	public void setUpdateArrayItemStream(boolean val) {
		this.updateArray[0] = val;
	}

	public void setUpdateArrayItemWeeklyPick(boolean val) {
		this.updateArray[1] = val;
	}

	public void setUpdateArrayItemShow(boolean val) {
		this.updateArray[2] = val;
	}

	public void setUpdateArrayItemEvents(boolean val) {
		this.updateArray[3] = val;
	}

	public boolean getFbLoginStatus() {
		return fbLoginStatus;
	}

	public void setFbLoginStatus(boolean fbls) {
		this.fbLoginStatus = fbls;
	}

	/* Facebook */
	public String getFbName() {
		return fbName;
	}

	public void setFbName(String fbName_) {
		this.fbName = fbName_;
	}

	public String getFbEmail() {
		return fbEmail;
	}

	public void setFbEmail(String fbEmail_) {
		this.fbEmail = fbEmail_;
	}

	public String getFbBirthday() {
		return fbBirthday;
	}

	public void setFbBirthday(String fbBirthday_) {
		this.fbBirthday = fbBirthday_;
	}

	public String getFbLocation() {
		return fbLocation;
	}

	public void setFbLocation(String fbLocation_) {
		this.fbLocation = fbLocation_;
	}

	public String getFbGender() {
		return fbGender;
	}

	public void setFbGender(String fbGender_) {
		this.fbGender = fbGender_;
	}

	public String getFbMusicLiked() {
		return fbMusicLiked;
	}

	public void setFbMusicLiked(String fbMusicLiked_) {
		this.fbMusicLiked = fbMusicLiked_;
	}

	public String getFbUsername() {
		return fbUsername;
	}

	public void setFbUsername(String fbUsername_) {
		this.fbUsername = fbUsername_;
	}

	public String getFbUserId() {
		return fbUserId;
	}

	public void setFbUserId(String fbUserId_) {
		this.fbUserId = fbUserId_;
	}

	public byte[] getFbProfilePicture() {
		return fbProfilePicture;
	}

	public void setFbProfilePicture(byte[] img) {
		this.fbProfilePicture = img;
	}

	public boolean getIsSlidingPaneLayoutSlidable() {
		return isSlidingPaneLayoutSlidable;
	}

	public void setIsSlidingPaneLayoutSlidable(boolean slideable) {
		this.isSlidingPaneLayoutSlidable = slideable;
	}

	public boolean getIsOneTimeExecuted() {
		return isOneTimeExecuted;
	}

	public void setIsOneTimeExecuted(boolean isOne) {
		this.isOneTimeExecuted = isOne;
	}

	public float getTextSize() {
		return textSize;
	}

	public void setTextSize(float val) {
		this.textSize = val;
	}

	public String getHDStream() {
		return hd_stream_link;
	}

	public void setHDStream(String str) {
		this.hd_stream_link = str;
	}

	public String getSDStream() {
		return sd_stream_link;
	}

	public void setSDStream(String str) {
		this.sd_stream_link = str;
	}

	public String getTNLId() {
		return tnl_Id;
	}

	public void setTNLId(String id) {
		this.tnl_Id = id;
	}

	public String getDay() {
		return day;
	}

	public void setDay(String dy) {
		this.day = dy;
	}

	public int getDate() {
		return date;
	}

	public void setDate(int date) {
		this.date = date;
	}

	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public List<OurShowsDataModel> getShowsData() {
		return showsData;
	}

	public void setShowsData(List<OurShowsDataModel> showDataWithImgs) {
		this.showsData = showDataWithImgs;
	}

	public List<EventsDataModel> getEventsData() {
		return eventsData;
	}

	public void setEventsData(List<EventsDataModel> eventDataWithImgs) {
		this.eventsData = eventDataWithImgs;
	}

	/*
	 * public List<NewsDataModel> getNewsData() { return newsData; }
	 * 
	 * public void setNewsData(List<NewsDataModel> showDataWithImgs) {
	 * this.newsData = showDataWithImgs; }
	 */

	public byte[] getAlbumArtImage() {
		return albumArtImage;
	}

	public void setAlbumArtImage(byte[] aaImage) {
		this.albumArtImage = aaImage;
	}

	public int getScreenWidth() {
		return screenWidth;
	}

	public void setScreenWidth(int screenW) {
		this.screenWidth = screenW;
	}

	public int getScreenHeight() {
		return screenHeight;
	}

	public void setScreenHeight(int screenH) {
		this.screenHeight = screenH;
	}

	public int getTime() {
		Calendar c = Calendar.getInstance();
		int Hr24 = c.get(Calendar.HOUR_OF_DAY);
		int Min = c.get(Calendar.MINUTE);
		String tme = Hr24 + "" + Min;

		int ttbEdit = Integer.parseInt(tme) + getTimeDifference();
		int mod = ttbEdit % 100;

		if (mod >= 60) {
			ttbEdit += 40;
		}

		return ttbEdit;
	}

	public int getTimeDifference() {
		return timeDiffer;
	}

	public void setTimeDifference(int td) {
		timeDiffer = td;
	}

	public String getSongName() {
		return songName;
	}

	public void setSongName(String sName) {
		songName = sName;
	}

	public String getArtistName() {
		return artistName;
	}

	public void setArtistName(String aName) {
		artistName = aName;
	}

}